<!doctype html>
<html class="x-admin-sm">
<head>
    {include file="../tpl/header.html" /}
</head>
<body class="login-bg">
<div class="login layui-anim layui-anim-up">
    <div class="message">{:config('app.app_name')}-管理登录</div>
    <div id="darkbannerwrap"></div>
    <form method="post" class="layui-form" action="{:url('admin/pub/login')}">
        <div class="layui-form-item">
            <input name="phone" placeholder="登录名/手机号"  type="text" lay-verify="required" class="layui-input" >
        </div>
        <div class="layui-form-item">
            <input name="password" lay-verify="required" placeholder="密码"  type="password" class="layui-input">
        </div>
<!--        <div class="layui-form-item" style="padding-right:150px;position: relative;">-->
<!--            <div class="layui-form-inline">-->
<!--                <input name="code" lay-verify="required" placeholder="请输入阿拉伯数字验证码"  type="text" class="layui-input">-->
<!--            </div>-->
<!--            <div style="position: absolute;right: 0;top: 0;width: 150px;height: 50px;">-->
<!--                <img src="{:url('admin/login/verify')}" style="width: 150px;height: 50px;cursor: pointer;" alt="" class="layui-anim-fadein">-->
<!--            </div>-->
<!--        </div>-->
        <div class="layui-form-item">
            <input type="checkbox" value="1" name="remember" lay-skin="primary" title="保持登录" />
        </div>
        <div class="layui-form-item">
            <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
        </div>
    </form>
</div>
<script>
    $(function() {
        layui.use('form', function(){
            var form = layui.form;
            form.on('submit(login)', function(data){
                $.ajax({
                    url:"{:url('admin/pub/login')}",
                    type:'post',
                    data:data.field,
                    dataType:'json',
                    success:function(e){
                        if(e.code === 1){
                            // layer.msg(e.msg,function(){
                                location.href = e.data['url'];
                            // });
                        }else{
                            layer.msg(e.msg,{icon: 5,time: layer_msg_error_time});
                        }
                        update_verify();
                    }
                });
                return false;
            });
            //解决登录框嵌套在iframe里面的问题
            if(window.top !== window.self){
                top.location.href = location.href;
            }
        });
        $('.layui-anim-fadein').click(function () {
            update_verify();
        });

        function update_verify() {
            var url = $('.layui-anim-fadein').attr('src');
            $('.layui-anim-fadein').attr('src',url+'?'+Math.random());
        }

    });
</script>
{include file="../tpl/footer.html" /}
</body>
</html>